@@ -10,4 +10,4 @@ |
||
| 10 | 10 |
#= require spectrum |
| 11 | 11 |
#= require_tree ./components |
| 12 | 12 |
#= require_tree ./pages |
| 13 |
-#= require_self |
|
| 13 |
+#= require_self |
@@ -0,0 +1,15 @@ |
||
| 1 |
+class @ScenarioFormPage |
|
| 2 |
+ constructor:() -> |
|
| 3 |
+ @enabledSelect2() |
|
| 4 |
+ |
|
| 5 |
+ format: (icon) -> |
|
| 6 |
+ originalOption = icon.element |
|
| 7 |
+ '<i class="fa ' + $(originalOption).data('icon') + '"></i> ' + icon.text
|
|
| 8 |
+ |
|
| 9 |
+ enabledSelect2: () -> |
|
| 10 |
+ $('.select2-fountawesome-icon').select2
|
|
| 11 |
+ width: '100%' |
|
| 12 |
+ formatResult: @format |
|
| 13 |
+ |
|
| 14 |
+$ -> |
|
| 15 |
+ Utils.registerPage(ScenarioFormPage, forPathsMatching: /^scenarios/) |
@@ -47,13 +47,14 @@ class ScenariosController < ApplicationController |
||
| 47 | 47 |
@scenario = Scenario.find(params[:id]) |
| 48 | 48 |
raise ActiveRecord::RecordNotFound unless @scenario.public? || (current_user && current_user.id == @scenario.user_id) |
| 49 | 49 |
|
| 50 |
- @exporter = AgentsExporter.new(:name => @scenario.name, |
|
| 51 |
- :description => @scenario.description, |
|
| 52 |
- :guid => @scenario.guid, |
|
| 53 |
- :tag_fg_color => @scenario.tag_fg_color, |
|
| 54 |
- :tag_bg_color => @scenario.tag_bg_color, |
|
| 55 |
- :source_url => @scenario.public? && export_scenario_url(@scenario), |
|
| 56 |
- :agents => @scenario.agents) |
|
| 50 |
+ @exporter = AgentsExporter.new(name: @scenario.name, |
|
| 51 |
+ description: @scenario.description, |
|
| 52 |
+ guid: @scenario.guid, |
|
| 53 |
+ tag_fg_color: @scenario.tag_fg_color, |
|
| 54 |
+ tag_bg_color: @scenario.tag_bg_color, |
|
| 55 |
+ icon: @scenario.icon, |
|
| 56 |
+ source_url: @scenario.public? && export_scenario_url(@scenario), |
|
| 57 |
+ agents: @scenario.agents) |
|
| 57 | 58 |
response.headers['Content-Disposition'] = 'attachment; filename="' + @exporter.filename + '"' |
| 58 | 59 |
render :json => JSON.pretty_generate(@exporter.as_json) |
| 59 | 60 |
end |
@@ -63,12 +63,14 @@ class ScenarioImport |
||
| 63 | 63 |
control_links = parsed_data['control_links'] || [] |
| 64 | 64 |
tag_fg_color = parsed_data['tag_fg_color'] |
| 65 | 65 |
tag_bg_color = parsed_data['tag_bg_color'] |
| 66 |
+ icon = parsed_data['icon'] |
|
| 66 | 67 |
source_url = parsed_data['source_url'].presence || nil |
| 67 | 68 |
@scenario = user.scenarios.where(:guid => guid).first_or_initialize |
| 68 |
- @scenario.update_attributes!(:name => name, :description => description, |
|
| 69 |
- :source_url => source_url, :public => false, |
|
| 70 |
- :tag_fg_color => tag_fg_color, |
|
| 71 |
- :tag_bg_color => tag_bg_color) |
|
| 69 |
+ @scenario.update_attributes!(name: name, description: description, |
|
| 70 |
+ source_url: source_url, public: false, |
|
| 71 |
+ tag_fg_color: tag_fg_color, |
|
| 72 |
+ tag_bg_color: tag_bg_color, |
|
| 73 |
+ icon: icon) |
|
| 72 | 74 |
|
| 73 | 75 |
unless options[:skip_agents] |
| 74 | 76 |
created_agents = agent_diffs.map do |agent_diff| |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 |
class Scenario < ActiveRecord::Base |
| 2 | 2 |
include HasGuid |
| 3 | 3 |
|
| 4 |
- attr_accessible :name, :agent_ids, :description, :public, :source_url, :tag_fg_color, :tag_bg_color |
|
| 4 |
+ attr_accessible :name, :agent_ids, :description, :public, :source_url, |
|
| 5 |
+ :tag_fg_color, :tag_bg_color, :icon |
|
| 5 | 6 |
|
| 6 | 7 |
belongs_to :user, :counter_cache => :scenario_count, :inverse_of => :scenarios |
| 7 | 8 |
has_many :scenario_memberships, :dependent => :destroy, :inverse_of => :scenario |
@@ -27,6 +28,12 @@ class Scenario < ActiveRecord::Base |
||
| 27 | 28 |
destroy |
| 28 | 29 |
end |
| 29 | 30 |
|
| 31 |
+ def self.icons |
|
| 32 |
+ @icons ||= begin |
|
| 33 |
+ YAML.load_file(Rails.root.join('config/icons.yml'))
|
|
| 34 |
+ end |
|
| 35 |
+ end |
|
| 36 |
+ |
|
| 30 | 37 |
private |
| 31 | 38 |
|
| 32 | 39 |
def unique_agent_ids |
@@ -37,6 +44,8 @@ class Scenario < ActiveRecord::Base |
||
| 37 | 44 |
end |
| 38 | 45 |
|
| 39 | 46 |
def agents_are_owned |
| 40 |
- errors.add(:agents, "must be owned by you") unless agents.all? {|s| s.user == user }
|
|
| 47 |
+ unless agents.all? { |s| s.user == user }
|
|
| 48 |
+ errors.add(:agents, 'must be owned by you') |
|
| 49 |
+ end |
|
| 41 | 50 |
end |
| 42 | 51 |
end |
@@ -50,6 +50,18 @@ |
||
| 50 | 50 |
<div class="col-md-4"> |
| 51 | 51 |
<div class="form-group"> |
| 52 | 52 |
<div> |
| 53 |
+ <%= f.label :icon %> |
|
| 54 |
+ <%= f.select(:icon, options_for_select(Scenario.icons), {},
|
|
| 55 |
+ {:style => "font-family:'FontAwesome', Arial;", :class => 'select2-fountawesome-icon'}) %>
|
|
| 56 |
+ </div> |
|
| 57 |
+ </div> |
|
| 58 |
+ </div> |
|
| 59 |
+ </div> |
|
| 60 |
+ |
|
| 61 |
+ <div class="row"> |
|
| 62 |
+ <div class="col-md-4"> |
|
| 63 |
+ <div class="form-group"> |
|
| 64 |
+ <div> |
|
| 53 | 65 |
<%= f.label :agents %> |
| 54 | 66 |
<%= f.select(:agent_ids, |
| 55 | 67 |
options_for_select(current_user.agents.pluck(:name, :id), @scenario.agent_ids), |
@@ -21,7 +21,11 @@ |
||
| 21 | 21 |
<% @scenarios.each do |scenario| %> |
| 22 | 22 |
<tr> |
| 23 | 23 |
<td> |
| 24 |
- <%= scenario_label(scenario, content_tag(:i, '', class: 'glyphicon glyphicon-font')) %> |
|
| 24 |
+ <% if scenario.icon.blank? || scenario.icon.nil? %> |
|
| 25 |
+ <%= scenario_label(scenario, icon('gear'))%>
|
|
| 26 |
+ <% else %> |
|
| 27 |
+ <%= scenario_label(scenario, icon(scenario.icon))%> |
|
| 28 |
+ <% end %> |
|
| 25 | 29 |
<%= link_to(scenario.name, scenario) %> |
| 26 | 30 |
</td> |
| 27 | 31 |
<td><%= link_to pluralize(scenario.agents.count, "agent"), scenario %></td> |
@@ -0,0 +1,675 @@ |
||
| 1 |
+- [Gear, gear, data-icon: fa-gear] |
|
| 2 |
+- [Globe, globe, data-icon: fa-globe] |
|
| 3 |
+- [Adjust, adjust, data-icon: fa-adjust] |
|
| 4 |
+- [Camera, camera, data-icon: fa-camera] |
|
| 5 |
+- [Glass, glass, data-icon: fa-glass] |
|
| 6 |
+- [Music, music, data-icon: fa-music] |
|
| 7 |
+- [Heart, heart, data-icon: fa-heart] |
|
| 8 |
+- [Star, star, data-icon: fa-star] |
|
| 9 |
+- [Film, film, data-icon: fa-film] |
|
| 10 |
+- [Signal, signal, data-icon: fa-signal] |
|
| 11 |
+- [Home, home, data-icon: fa-home] |
|
| 12 |
+- [Automobile, automobile, data-icon: fa-automobile] |
|
| 13 |
+- [Clock, clock-o, data-icon: fa-clock-o] |
|
| 14 |
+- [Road, road, data-icon: fa-road] |
|
| 15 |
+- [Inbox, inbox, data-icon: fa-inbox] |
|
| 16 |
+- [Lock, lock, data-icon: fa-lock] |
|
| 17 |
+- [Flag, flag, data-icon: fa-flag] |
|
| 18 |
+- [Spoon, spoon, data-icon: fa-spoon] |
|
| 19 |
+- [Barcode, barcode, data-icon: fa-barcode] |
|
| 20 |
+- [Book, book, data-icon: fa-book] |
|
| 21 |
+- [Building, building, data-icon: fa-building] |
|
| 22 |
+- [Video Camera, video-camera, data-icon: fa-video-camera] |
|
| 23 |
+- [Photo, photo, data-icon: fa-photo] |
|
| 24 |
+- [Headphones, headphones, data-icon: fa-headphones] |
|
| 25 |
+- [Gift, gift, data-icon: fa-gift] |
|
| 26 |
+- [Leaf, leaf, data-icon: fa-leaf] |
|
| 27 |
+- [Fire, fire, data-icon: fa-fire] |
|
| 28 |
+- [Eye, eye, data-icon: fa-eye] |
|
| 29 |
+- [Language, language, data-icon: fa-language] |
|
| 30 |
+- [Key, key, data-icon: fa-key] |
|
| 31 |
+- [Paw, paw, data-icon: fa-paw] |
|
| 32 |
+- [Tags, tags, data-icon: fa-tags] |
|
| 33 |
+- [Dashboard, dashboard, data-icon: fa-dashboard] |
|
| 34 |
+- [Camera Retro, camera-retro, data-icon: fa-camera-retro] |
|
| 35 |
+- [Plane, plane, data-icon: fa-plane] |
|
| 36 |
+- [Calendar, calendar, data-icon: fa-calendar] |
|
| 37 |
+- [Bullhorn, bullhorn, data-icon: fa-bullhorn] |
|
| 38 |
+- [Gears, gears, data-icon: fa-gears] |
|
| 39 |
+- [Bell, bell, data-icon: fa-bell] |
|
| 40 |
+- [Gavel, gavel, data-icon: fa-gavel] |
|
| 41 |
+- [Tachometer, tachometer, data-icon: fa-tachometer] |
|
| 42 |
+- [Bank, bank, data-icon: fa-bank] |
|
| 43 |
+- [Coffee, coffee, data-icon: fa-coffee] |
|
| 44 |
+- [Cutlery, cutlery, data-icon: fa-cutlery] |
|
| 45 |
+- [Table, table, data-icon: fa-table] |
|
| 46 |
+- [Magic, magic, data-icon: fa-magic] |
|
| 47 |
+- [Truck, truck, data-icon: fa-truck] |
|
| 48 |
+- [Pencil, pencil, data-icon: fa-pencil] |
|
| 49 |
+- [Cloud, cloud, data-icon: fa-cloud] |
|
| 50 |
+- [Scissors, scissors, data-icon: fa-scissors] |
|
| 51 |
+ |
|
| 52 |
+ |
|
| 53 |
+#More icons options## |
|
| 54 |
+##################### |
|
| 55 |
+#child |
|
| 56 |
+## fax |
|
| 57 |
|
|
| 58 |
+# cube |
|
| 59 |
+# th-large |
|
| 60 |
+# th |
|
| 61 |
+# th-list |
|
| 62 |
+# arrow-circle-o-up |
|
| 63 |
+# play-circle-o |
|
| 64 |
+# rotate-right |
|
| 65 |
+# list-alt |
|
| 66 |
+# volume-off |
|
| 67 |
+# volume-down |
|
| 68 |
+# volume-up |
|
| 69 |
+# qrcode |
|
| 70 |
+# tag |
|
| 71 |
+# camera |
|
| 72 |
+# font |
|
| 73 |
+# bold |
|
| 74 |
+# italic |
|
| 75 |
+# text-height |
|
| 76 |
+# text-width |
|
| 77 |
+# align-left |
|
| 78 |
+# align-center |
|
| 79 |
+# align-right |
|
| 80 |
+# align-justify |
|
| 81 |
+# list |
|
| 82 |
+# dedent |
|
| 83 |
+# rss |
|
| 84 |
+# outdent |
|
| 85 |
+# indent |
|
| 86 |
+# picture-o |
|
| 87 |
+# map-marker |
|
| 88 |
+# adjust |
|
| 89 |
+# tint |
|
| 90 |
+# edit |
|
| 91 |
+# pencil-square-o |
|
| 92 |
+# share-square-o |
|
| 93 |
+# check-square-o |
|
| 94 |
+# arrows |
|
| 95 |
+# step-backward |
|
| 96 |
+# fast-backward |
|
| 97 |
+# backward |
|
| 98 |
+# play |
|
| 99 |
+# pause |
|
| 100 |
+# stop |
|
| 101 |
+# forward |
|
| 102 |
+# fast-forward |
|
| 103 |
+# step-forward |
|
| 104 |
+# eject |
|
| 105 |
+# chevron-left |
|
| 106 |
+# chevron-right |
|
| 107 |
+# plus-circle |
|
| 108 |
+# minus-circle |
|
| 109 |
+# times-circle |
|
| 110 |
+# check-circle |
|
| 111 |
+# question-circle |
|
| 112 |
+# info-circle |
|
| 113 |
+# crosshairs |
|
| 114 |
+# times-circle-o |
|
| 115 |
+# check-circle-o |
|
| 116 |
+# arrow-left |
|
| 117 |
+# arrow-right |
|
| 118 |
+# arrow-up |
|
| 119 |
+# arrow-down |
|
| 120 |
+# mail-forward |
|
| 121 |
+# share |
|
| 122 |
+# expand |
|
| 123 |
+# compress |
|
| 124 |
+# plus |
|
| 125 |
+# minus |
|
| 126 |
+# asterisk |
|
| 127 |
+# exclamation-circle |
|
| 128 |
+# eye-slash |
|
| 129 |
+# warning |
|
| 130 |
+# exclamation-triangle |
|
| 131 |
+# random |
|
| 132 |
+# comment |
|
| 133 |
+# magnet |
|
| 134 |
+# chevron-up |
|
| 135 |
+# chevron-down |
|
| 136 |
+# retweet |
|
| 137 |
+# shopping-cart |
|
| 138 |
+# folder |
|
| 139 |
+# folder-open |
|
| 140 |
+# arrows-v |
|
| 141 |
+# arrows-h |
|
| 142 |
+# bar-chart-o |
|
| 143 |
+# bar-chart |
|
| 144 |
+# twitter-square |
|
| 145 |
+# facebook-square |
|
| 146 |
+# comments |
|
| 147 |
+# thumbs-o-up |
|
| 148 |
+# thumbs-o-down |
|
| 149 |
+# star-half |
|
| 150 |
+# heart-o |
|
| 151 |
+# sign-out |
|
| 152 |
+# linkedin-square |
|
| 153 |
+# thumb-tack |
|
| 154 |
+# external-link |
|
| 155 |
+# sign-in |
|
| 156 |
+# trophy |
|
| 157 |
+# github-square |
|
| 158 |
+# upload |
|
| 159 |
+# lemon-o |
|
| 160 |
+# phone |
|
| 161 |
+# square-o |
|
| 162 |
+# bookmark-o |
|
| 163 |
+# phone-square |
|
| 164 |
|
|
| 165 |
+# facebook-f |
|
| 166 |
|
|
| 167 |
+# github |
|
| 168 |
+# unlock |
|
| 169 |
+# credit-card |
|
| 170 |
+# hdd-o |
|
| 171 |
+# certificate |
|
| 172 |
+# hand-o-right |
|
| 173 |
+# hand-o-left |
|
| 174 |
+# hand-o-up |
|
| 175 |
+# hand-o-down |
|
| 176 |
+# arrow-circle-left |
|
| 177 |
+# arrow-circle-right |
|
| 178 |
+# arrow-circle-up |
|
| 179 |
+# arrow-circle-down |
|
| 180 |
+# wrench |
|
| 181 |
+# tasks |
|
| 182 |
+# filter |
|
| 183 |
+# briefcase |
|
| 184 |
+# arrows-alt |
|
| 185 |
+# group |
|
| 186 |
+# users |
|
| 187 |
+# chain |
|
| 188 |
+# link |
|
| 189 |
+# flask |
|
| 190 |
+# cut |
|
| 191 |
+# copy |
|
| 192 |
+# files-o |
|
| 193 |
+# paperclip |
|
| 194 |
+# save |
|
| 195 |
+# floppy-o |
|
| 196 |
+# square |
|
| 197 |
+# navicon |
|
| 198 |
+# reorder |
|
| 199 |
+# bars |
|
| 200 |
+# list-ul |
|
| 201 |
+# list-ol |
|
| 202 |
+# strikethrough |
|
| 203 |
+# underline |
|
| 204 |
|
|
| 205 |
+# pinterest-square |
|
| 206 |
+# google-plus-square |
|
| 207 |
+# google-plus |
|
| 208 |
+# money |
|
| 209 |
+# caret-down |
|
| 210 |
+# caret-up |
|
| 211 |
+# caret-left |
|
| 212 |
+# caret-right |
|
| 213 |
+# columns |
|
| 214 |
+# unsorted |
|
| 215 |
+# sort |
|
| 216 |
+# sort-down |
|
| 217 |
+# sort-desc |
|
| 218 |
+# sort-up |
|
| 219 |
+# sort-asc |
|
| 220 |
+# envelope |
|
| 221 |
|
|
| 222 |
+# rotate-left |
|
| 223 |
+# undo |
|
| 224 |
+# legal |
|
| 225 |
+# feed |
|
| 226 |
+# comment-o |
|
| 227 |
+# comments-o |
|
| 228 |
+# flash |
|
| 229 |
+# bolt |
|
| 230 |
+# sitemap |
|
| 231 |
+# umbrella |
|
| 232 |
+# paste |
|
| 233 |
+# clipboard |
|
| 234 |
+# lightbulb-o |
|
| 235 |
+# exchange |
|
| 236 |
+# cloud-download |
|
| 237 |
+# cloud-upload |
|
| 238 |
+# user-md |
|
| 239 |
+# stethoscope |
|
| 240 |
+# suitcase |
|
| 241 |
+# bell-o |
|
| 242 |
+# file-text-o |
|
| 243 |
+# building-o |
|
| 244 |
+# hospital-o |
|
| 245 |
+# ambulance |
|
| 246 |
+# medkit |
|
| 247 |
+# fighter-jet |
|
| 248 |
+# beer |
|
| 249 |
+# h-square |
|
| 250 |
+# plus-square |
|
| 251 |
+# angle-double-left |
|
| 252 |
+# angle-double-right |
|
| 253 |
+# angle-double-up |
|
| 254 |
+# angle-double-down |
|
| 255 |
+# angle-left |
|
| 256 |
+# angle-right |
|
| 257 |
+# angle-up |
|
| 258 |
+# angle-down |
|
| 259 |
+# desktop |
|
| 260 |
+# laptop |
|
| 261 |
+# tablet |
|
| 262 |
+# mobile-phone |
|
| 263 |
+# mobile |
|
| 264 |
+# circle-o |
|
| 265 |
+# quote-left |
|
| 266 |
+# quote-right |
|
| 267 |
+# spinner |
|
| 268 |
+# circle |
|
| 269 |
+# mail-reply |
|
| 270 |
+# reply |
|
| 271 |
+# github-alt |
|
| 272 |
+# folder-o |
|
| 273 |
+# folder-open-o |
|
| 274 |
+# smile-o |
|
| 275 |
+# frown-o |
|
| 276 |
+# meh-o |
|
| 277 |
+# gamepad |
|
| 278 |
+# keyboard-o |
|
| 279 |
+# flag-o |
|
| 280 |
+# flag-checkered |
|
| 281 |
+# terminal |
|
| 282 |
+# code |
|
| 283 |
+# mail-reply-all |
|
| 284 |
+# reply-all |
|
| 285 |
+# star-half-empty |
|
| 286 |
+# star-half-full |
|
| 287 |
+# star-half-o |
|
| 288 |
+# location-arrow |
|
| 289 |
+# crop |
|
| 290 |
+# code-fork |
|
| 291 |
+# unlink |
|
| 292 |
+# chain-broken |
|
| 293 |
+# question |
|
| 294 |
+# info |
|
| 295 |
+# exclamation |
|
| 296 |
+# superscript |
|
| 297 |
+# subscript |
|
| 298 |
+# eraser |
|
| 299 |
+# puzzle-piece |
|
| 300 |
+# microphone |
|
| 301 |
+# microphone-slash |
|
| 302 |
+# shield |
|
| 303 |
+# calendar-o |
|
| 304 |
+# fire-extinguisher |
|
| 305 |
+# rocket |
|
| 306 |
+# maxcdn |
|
| 307 |
+# chevron-circle-left |
|
| 308 |
+# chevron-circle-right |
|
| 309 |
+# chevron-circle-up |
|
| 310 |
+# chevron-circle-down |
|
| 311 |
+# html5 |
|
| 312 |
+# css3 |
|
| 313 |
+# anchor |
|
| 314 |
+# unlock-alt |
|
| 315 |
+# bullseye |
|
| 316 |
+# ellipsis-h |
|
| 317 |
+# ellipsis-v |
|
| 318 |
+# rss-square |
|
| 319 |
+# play-circle |
|
| 320 |
+# ticket |
|
| 321 |
+# minus-square |
|
| 322 |
+# minus-square-o |
|
| 323 |
+# level-up |
|
| 324 |
+# level-down |
|
| 325 |
+# check-square |
|
| 326 |
+# pencil-square |
|
| 327 |
+# external-link-square |
|
| 328 |
+# share-square |
|
| 329 |
+# compass |
|
| 330 |
+# toggle-down |
|
| 331 |
+# caret-square-o-down |
|
| 332 |
+# toggle-up |
|
| 333 |
+# caret-square-o-up |
|
| 334 |
+# toggle-right |
|
| 335 |
+# caret-square-o-right |
|
| 336 |
+# euro |
|
| 337 |
+# eur |
|
| 338 |
+# gbp |
|
| 339 |
+# dollar |
|
| 340 |
+# usd |
|
| 341 |
+# rupee |
|
| 342 |
+# inr |
|
| 343 |
+# cny |
|
| 344 |
+# rmb |
|
| 345 |
+# yen |
|
| 346 |
+# jpy |
|
| 347 |
+# ruble |
|
| 348 |
+# rouble |
|
| 349 |
+# rub |
|
| 350 |
+# won |
|
| 351 |
+# krw |
|
| 352 |
+# bitcoin |
|
| 353 |
+# btc |
|
| 354 |
+# file |
|
| 355 |
+# file-text |
|
| 356 |
+# sort-alpha-asc |
|
| 357 |
+# sort-alpha-desc |
|
| 358 |
+# sort-amount-asc |
|
| 359 |
+# sort-amount-desc |
|
| 360 |
+# sort-numeric-asc |
|
| 361 |
+# sort-numeric-desc |
|
| 362 |
+# thumbs-up |
|
| 363 |
+# thumbs-down |
|
| 364 |
+# youtube-square |
|
| 365 |
+# youtube |
|
| 366 |
|
|
| 367 |
+# xing-square |
|
| 368 |
+# youtube-play |
|
| 369 |
+# dropbox |
|
| 370 |
+# stack-overflow |
|
| 371 |
|
|
| 372 |
+# flickr |
|
| 373 |
+# adn |
|
| 374 |
+# bitbucket |
|
| 375 |
+# bitbucket-square |
|
| 376 |
+# tumblr |
|
| 377 |
+# tumblr-square |
|
| 378 |
+# long-arrow-down |
|
| 379 |
+# long-arrow-up |
|
| 380 |
+# long-arrow-left |
|
| 381 |
+# long-arrow-right |
|
| 382 |
+# apple |
|
| 383 |
+# windows |
|
| 384 |
+# android |
|
| 385 |
+# linux |
|
| 386 |
+# dribbble |
|
| 387 |
+# skype |
|
| 388 |
+# foursquare |
|
| 389 |
+# trello |
|
| 390 |
+# female |
|
| 391 |
+# male |
|
| 392 |
+# gittip |
|
| 393 |
+# gratipay |
|
| 394 |
+# sun-o |
|
| 395 |
+# moon-o |
|
| 396 |
+# archive |
|
| 397 |
+# bug |
|
| 398 |
+# vk |
|
| 399 |
|
|
| 400 |
+# renren |
|
| 401 |
+# pagelines |
|
| 402 |
+# stack-exchange |
|
| 403 |
+# arrow-circle-o-right |
|
| 404 |
+# arrow-circle-o-left |
|
| 405 |
+# toggle-left |
|
| 406 |
+# caret-square-o-left |
|
| 407 |
+# dot-circle-o |
|
| 408 |
+# wheelchair |
|
| 409 |
+# vimeo-square |
|
| 410 |
+# turkish-lira |
|
| 411 |
+# try |
|
| 412 |
+# plus-square-o |
|
| 413 |
+# space-shuttle |
|
| 414 |
+# slack |
|
| 415 |
+# envelope-square |
|
| 416 |
+# wordpress |
|
| 417 |
+# openid |
|
| 418 |
+# institution |
|
| 419 |
+# university |
|
| 420 |
+# mortar-board |
|
| 421 |
+# graduation-cap |
|
| 422 |
+# yahoo |
|
| 423 |
|
|
| 424 |
|
|
| 425 |
+# reddit-square |
|
| 426 |
+# stumbleupon-circle |
|
| 427 |
+# stumbleupon |
|
| 428 |
+# delicious |
|
| 429 |
+# digg |
|
| 430 |
+# pied-piper |
|
| 431 |
+# pied-piper-alt |
|
| 432 |
+# drupal |
|
| 433 |
+# joomla |
|
| 434 |
+# cubes |
|
| 435 |
+# behance |
|
| 436 |
+# behance-square |
|
| 437 |
+# steam |
|
| 438 |
+# steam-square |
|
| 439 |
+# recycle |
|
| 440 |
+# car |
|
| 441 |
+# cab |
|
| 442 |
+# taxi |
|
| 443 |
+# tree |
|
| 444 |
+# spotify |
|
| 445 |
+# deviantart |
|
| 446 |
+# soundcloud |
|
| 447 |
+# database |
|
| 448 |
+# file-pdf-o |
|
| 449 |
+# file-word-o |
|
| 450 |
+# file-excel-o |
|
| 451 |
+# file-powerpoint-o |
|
| 452 |
+# file-photo-o |
|
| 453 |
+# file-picture-o |
|
| 454 |
+# file-image-o |
|
| 455 |
+# file-zip-o |
|
| 456 |
+# file-archive-o |
|
| 457 |
+# file-sound-o |
|
| 458 |
+# file-audio-o |
|
| 459 |
+# file-movie-o |
|
| 460 |
+# file-video-o |
|
| 461 |
+# file-code-o |
|
| 462 |
+# vine |
|
| 463 |
+# codepen |
|
| 464 |
+# jsfiddle |
|
| 465 |
+# life-bouy |
|
| 466 |
+# life-buoy |
|
| 467 |
+# life-saver |
|
| 468 |
+# support |
|
| 469 |
+# life-ring |
|
| 470 |
+# circle-o-notch |
|
| 471 |
+# ra |
|
| 472 |
+# rebel |
|
| 473 |
+# ge |
|
| 474 |
+# empire |
|
| 475 |
+# git-square |
|
| 476 |
+# git |
|
| 477 |
+# y-combinator-square |
|
| 478 |
+# yc-square |
|
| 479 |
+# hacker-news |
|
| 480 |
+# tencent-weibo |
|
| 481 |
|
|
| 482 |
|
|
| 483 |
+# weixin |
|
| 484 |
+# send |
|
| 485 |
+# paper-plane |
|
| 486 |
+# send-o |
|
| 487 |
+# paper-plane-o |
|
| 488 |
+# history |
|
| 489 |
+# circle-thin |
|
| 490 |
+# header |
|
| 491 |
+# paragraph |
|
| 492 |
+# sliders |
|
| 493 |
+# share-alt |
|
| 494 |
+# share-alt-square |
|
| 495 |
+# bomb |
|
| 496 |
+# soccer-ball-o |
|
| 497 |
+# futbol-o |
|
| 498 |
+# tty |
|
| 499 |
+# binoculars |
|
| 500 |
+# plug |
|
| 501 |
+# slideshare |
|
| 502 |
+# twitch |
|
| 503 |
+# yelp |
|
| 504 |
+# newspaper-o |
|
| 505 |
+# wifi |
|
| 506 |
+# calculator |
|
| 507 |
+# paypal |
|
| 508 |
+# google-wallet |
|
| 509 |
+# cc-visa |
|
| 510 |
+# cc-mastercard |
|
| 511 |
+# cc-discover |
|
| 512 |
+# cc-amex |
|
| 513 |
+# cc-paypal |
|
| 514 |
+# cc-stripe |
|
| 515 |
+# bell-slash |
|
| 516 |
+# bell-slash-o |
|
| 517 |
+# trash |
|
| 518 |
+# copyright |
|
| 519 |
+# at |
|
| 520 |
+# eyedropper |
|
| 521 |
+# paint-brush |
|
| 522 |
+# birthday-cake |
|
| 523 |
+# area-chart |
|
| 524 |
+# pie-chart |
|
| 525 |
+# line-chart |
|
| 526 |
+# lastfm |
|
| 527 |
+# lastfm-square |
|
| 528 |
+# toggle-off |
|
| 529 |
+# toggle-on |
|
| 530 |
+# bicycle |
|
| 531 |
+# bus |
|
| 532 |
+# ioxhost |
|
| 533 |
+# angellist |
|
| 534 |
+# cc |
|
| 535 |
+# shekel |
|
| 536 |
+# sheqel |
|
| 537 |
+# ils |
|
| 538 |
+# meanpath |
|
| 539 |
+# buysellads |
|
| 540 |
+# connectdevelop |
|
| 541 |
+# dashcube |
|
| 542 |
+# forumbee |
|
| 543 |
+# leanpub |
|
| 544 |
+# sellsy |
|
| 545 |
+# shirtsinbulk |
|
| 546 |
+# simplybuilt |
|
| 547 |
+# skyatlas |
|
| 548 |
+# cart-plus |
|
| 549 |
+# cart-arrow-down |
|
| 550 |
+# diamond |
|
| 551 |
+# ship |
|
| 552 |
+# user-secret |
|
| 553 |
+# motorcycle |
|
| 554 |
+# street-view |
|
| 555 |
+# heartbeat |
|
| 556 |
+# venus |
|
| 557 |
+# mars |
|
| 558 |
+# mercury |
|
| 559 |
+# intersex |
|
| 560 |
+# transgender |
|
| 561 |
+# transgender-alt |
|
| 562 |
+# venus-double |
|
| 563 |
+# mars-double |
|
| 564 |
+# venus-mars |
|
| 565 |
+# mars-stroke |
|
| 566 |
+# mars-stroke-v |
|
| 567 |
+# mars-stroke-h |
|
| 568 |
+# neuter |
|
| 569 |
+# genderless |
|
| 570 |
+# facebook-official |
|
| 571 |
+# pinterest-p |
|
| 572 |
|
|
| 573 |
+# server |
|
| 574 |
+# user-plus |
|
| 575 |
+# user-times |
|
| 576 |
+# hotel |
|
| 577 |
+# bed |
|
| 578 |
+# viacoin |
|
| 579 |
+# train |
|
| 580 |
+# subway |
|
| 581 |
+# medium |
|
| 582 |
+# yc |
|
| 583 |
+# y-combinator |
|
| 584 |
+# optin-monster |
|
| 585 |
+# opencart |
|
| 586 |
+# expeditedssl |
|
| 587 |
+# battery-4 |
|
| 588 |
+# battery-full |
|
| 589 |
+# battery-half |
|
| 590 |
+# battery-quarter |
|
| 591 |
+# battery-0 |
|
| 592 |
+# battery-empty |
|
| 593 |
+# mouse-pointer |
|
| 594 |
+# i-cursor |
|
| 595 |
+# object-group |
|
| 596 |
+# object-ungroup |
|
| 597 |
+# sticky-note |
|
| 598 |
+# sticky-note-o |
|
| 599 |
+# cc-jcb |
|
| 600 |
+# cc-diners-club |
|
| 601 |
+# clone |
|
| 602 |
+# balance-scale |
|
| 603 |
+# hourglass-o |
|
| 604 |
+# hourglass-1 |
|
| 605 |
+# hourglass-start |
|
| 606 |
+# hourglass-2 |
|
| 607 |
+# hourglass-half |
|
| 608 |
+# hourglass-3 |
|
| 609 |
+# hourglass-end |
|
| 610 |
+# hourglass |
|
| 611 |
+# hand-grab-o |
|
| 612 |
+# hand-rock-o |
|
| 613 |
+# hand-stop-o |
|
| 614 |
+# hand-paper-o |
|
| 615 |
+# hand-scissors-o |
|
| 616 |
+# hand-lizard-o |
|
| 617 |
+# hand-spock-o |
|
| 618 |
+# hand-pointer-o |
|
| 619 |
+# hand-peace-o |
|
| 620 |
+# trademark |
|
| 621 |
+# registered |
|
| 622 |
+# creative-commons |
|
| 623 |
+# gg |
|
| 624 |
+# gg-circle |
|
| 625 |
+# tripadvisor |
|
| 626 |
+# odnoklassniki |
|
| 627 |
+# odnoklassniki-square |
|
| 628 |
+# get-pocket |
|
| 629 |
+# wikipedia-w |
|
| 630 |
+# safari |
|
| 631 |
+# chrome |
|
| 632 |
+# firefox |
|
| 633 |
+# opera |
|
| 634 |
+# internet-explorer |
|
| 635 |
+# tv |
|
| 636 |
+# television |
|
| 637 |
+# contao |
|
| 638 |
+# 500px |
|
| 639 |
+# amazon |
|
| 640 |
+# calendar-plus-o |
|
| 641 |
+# calendar-minus-o |
|
| 642 |
+# calendar-times-o |
|
| 643 |
+# calendar-check-o |
|
| 644 |
+# industry |
|
| 645 |
+# map-pin |
|
| 646 |
+# map-signs |
|
| 647 |
+# map-o |
|
| 648 |
+# map |
|
| 649 |
+# commenting |
|
| 650 |
+# commenting-o |
|
| 651 |
+# houzz |
|
| 652 |
+# vimeo |
|
| 653 |
+# black-tie |
|
| 654 |
+# fonticons |
|
| 655 |
+# reddit-alien |
|
| 656 |
+# edge |
|
| 657 |
+# credit-card-alt |
|
| 658 |
+# codiepie |
|
| 659 |
+# modx |
|
| 660 |
+# fort-awesome |
|
| 661 |
+# usb |
|
| 662 |
+# product-hunt |
|
| 663 |
+# mixcloud |
|
| 664 |
+# scribd |
|
| 665 |
+# pause-circle |
|
| 666 |
+# pause-circle-o |
|
| 667 |
+# stop-circle |
|
| 668 |
+# stop-circle-o |
|
| 669 |
+# shopping-bag |
|
| 670 |
+# shopping-basket |
|
| 671 |
+# hashtag |
|
| 672 |
+# bluetooth |
|
| 673 |
+# bluetooth-b |
|
| 674 |
+# percent |
|
| 675 |
+ |
@@ -0,0 +1,5 @@ |
||
| 1 |
+class AddIconToScenarios < ActiveRecord::Migration |
|
| 2 |
+ def change |
|
| 3 |
+ add_column :scenarios, :icon, :string |
|
| 4 |
+ end |
|
| 5 |
+end |
@@ -12,17 +12,18 @@ class AgentsExporter |
||
| 12 | 12 |
|
| 13 | 13 |
def as_json(opts = {})
|
| 14 | 14 |
{
|
| 15 |
- :schema_version => 1, |
|
| 16 |
- :name => options[:name].presence || 'No name provided', |
|
| 17 |
- :description => options[:description].presence || 'No description provided', |
|
| 18 |
- :source_url => options[:source_url], |
|
| 19 |
- :guid => options[:guid], |
|
| 20 |
- :tag_fg_color => options[:tag_fg_color], |
|
| 21 |
- :tag_bg_color => options[:tag_bg_color], |
|
| 22 |
- :exported_at => Time.now.utc.iso8601, |
|
| 23 |
- :agents => agents.map { |agent| agent_as_json(agent) },
|
|
| 24 |
- :links => links, |
|
| 25 |
- :control_links => control_links |
|
| 15 |
+ schema_version: 1, |
|
| 16 |
+ name: options[:name].presence || 'No name provided', |
|
| 17 |
+ description: options[:description].presence || 'No description provided', |
|
| 18 |
+ source_url: options[:source_url], |
|
| 19 |
+ guid: options[:guid], |
|
| 20 |
+ tag_fg_color: options[:tag_fg_color], |
|
| 21 |
+ tag_bg_color: options[:tag_bg_color], |
|
| 22 |
+ icon: options[:icon], |
|
| 23 |
+ exported_at: Time.now.utc.iso8601, |
|
| 24 |
+ agents: agents.map { |agent| agent_as_json(agent) },
|
|
| 25 |
+ links: links, |
|
| 26 |
+ control_links: control_links |
|
| 26 | 27 |
} |
| 27 | 28 |
end |
| 28 | 29 |
|
@@ -5,6 +5,7 @@ describe ScenarioImport do |
||
| 5 | 5 |
let(:guid) { "somescenarioguid" }
|
| 6 | 6 |
let(:tag_fg_color) { "#ffffff" }
|
| 7 | 7 |
let(:tag_bg_color) { "#000000" }
|
| 8 |
+ let(:icon) { 'Star' }
|
|
| 8 | 9 |
let(:description) { "This is a cool Huginn Scenario that does something useful!" }
|
| 9 | 10 |
let(:name) { "A useful Scenario" }
|
| 10 | 11 |
let(:source_url) { "http://example.com/scenarios/2/export.json" }
|
@@ -61,22 +62,23 @@ describe ScenarioImport do |
||
| 61 | 62 |
end |
| 62 | 63 |
let(:valid_parsed_data) do |
| 63 | 64 |
{
|
| 64 |
- :schema_version => 1, |
|
| 65 |
- :name => name, |
|
| 66 |
- :description => description, |
|
| 67 |
- :guid => guid, |
|
| 68 |
- :tag_fg_color => tag_fg_color, |
|
| 69 |
- :tag_bg_color => tag_bg_color, |
|
| 70 |
- :source_url => source_url, |
|
| 71 |
- :exported_at => 2.days.ago.utc.iso8601, |
|
| 72 |
- :agents => [ |
|
| 65 |
+ schema_version: 1, |
|
| 66 |
+ name: name, |
|
| 67 |
+ description: description, |
|
| 68 |
+ guid: guid, |
|
| 69 |
+ tag_fg_color: tag_fg_color, |
|
| 70 |
+ tag_bg_color: tag_bg_color, |
|
| 71 |
+ icon: icon, |
|
| 72 |
+ source_url: source_url, |
|
| 73 |
+ exported_at: 2.days.ago.utc.iso8601, |
|
| 74 |
+ agents: [ |
|
| 73 | 75 |
valid_parsed_weather_agent_data, |
| 74 | 76 |
valid_parsed_trigger_agent_data |
| 75 | 77 |
], |
| 76 |
- :links => [ |
|
| 78 |
+ links: [ |
|
| 77 | 79 |
{ :source => 0, :receiver => 1 }
|
| 78 | 80 |
], |
| 79 |
- :control_links => [] |
|
| 81 |
+ control_links: [] |
|
| 80 | 82 |
} |
| 81 | 83 |
end |
| 82 | 84 |
let(:valid_data) { valid_parsed_data.to_json }
|
@@ -191,6 +193,7 @@ describe ScenarioImport do |
||
| 191 | 193 |
expect(scenario_import.scenario.guid).to eq(guid) |
| 192 | 194 |
expect(scenario_import.scenario.tag_fg_color).to eq(tag_fg_color) |
| 193 | 195 |
expect(scenario_import.scenario.tag_bg_color).to eq(tag_bg_color) |
| 196 |
+ expect(scenario_import.scenario.icon).to eq(icon) |
|
| 194 | 197 |
expect(scenario_import.scenario.source_url).to eq(source_url) |
| 195 | 198 |
expect(scenario_import.scenario.public).to be_falsey |
| 196 | 199 |
end |
@@ -340,6 +343,7 @@ describe ScenarioImport do |
||
| 340 | 343 |
expect(existing_scenario.guid).to eq(guid) |
| 341 | 344 |
expect(existing_scenario.tag_fg_color).to eq(tag_fg_color) |
| 342 | 345 |
expect(existing_scenario.tag_bg_color).to eq(tag_bg_color) |
| 346 |
+ expect(existing_scenario.icon).to eq(icon) |
|
| 343 | 347 |
expect(existing_scenario.description).to eq(description) |
| 344 | 348 |
expect(existing_scenario.name).to eq(name) |
| 345 | 349 |
expect(existing_scenario.source_url).to eq(source_url) |
@@ -507,7 +511,7 @@ describe ScenarioImport do |
||
| 507 | 511 |
end |
| 508 | 512 |
end |
| 509 | 513 |
end |
| 510 |
- |
|
| 514 |
+ |
|
| 511 | 515 |
context "when Bob imports Jane's scenario" do |
| 512 | 516 |
let!(:existing_scenario) do |
| 513 | 517 |
_existing_scenerio = users(:jane).scenarios.build(:name => "an existing scenario", :description => "something") |
@@ -515,7 +519,7 @@ describe ScenarioImport do |
||
| 515 | 519 |
_existing_scenerio.save! |
| 516 | 520 |
_existing_scenerio |
| 517 | 521 |
end |
| 518 |
- |
|
| 522 |
+ |
|
| 519 | 523 |
describe "#import" do |
| 520 | 524 |
it "makes a new scenario for Bob" do |
| 521 | 525 |
expect {
|
@@ -529,6 +533,7 @@ describe ScenarioImport do |
||
| 529 | 533 |
expect(scenario_import.scenario.guid).to eq(guid) |
| 530 | 534 |
expect(scenario_import.scenario.tag_fg_color).to eq(tag_fg_color) |
| 531 | 535 |
expect(scenario_import.scenario.tag_bg_color).to eq(tag_bg_color) |
| 536 |
+ expect(scenario_import.scenario.icon).to eq(icon) |
|
| 532 | 537 |
expect(scenario_import.scenario.source_url).to eq(source_url) |
| 533 | 538 |
expect(scenario_import.scenario.public).to be_falsey |
| 534 | 539 |
end |
@@ -7,11 +7,13 @@ describe AgentsExporter do |
||
| 7 | 7 |
let(:guid) { "some-guid" }
|
| 8 | 8 |
let(:tag_fg_color) { "#ffffff" }
|
| 9 | 9 |
let(:tag_bg_color) { "#000000" }
|
| 10 |
+ let(:icon) { 'Camera' }
|
|
| 10 | 11 |
let(:source_url) { "http://yourhuginn.com/scenarios/2/export.json" }
|
| 11 | 12 |
let(:agent_list) { [agents(:jane_weather_agent), agents(:jane_rain_notifier_agent)] }
|
| 12 | 13 |
let(:exporter) { AgentsExporter.new(
|
| 13 |
- :agents => agent_list, :name => name, :description => description, :source_url => source_url, |
|
| 14 |
- :guid => guid, :tag_fg_color => tag_fg_color, :tag_bg_color => tag_bg_color) } |
|
| 14 |
+ agents: agent_list, name: name, description: description, |
|
| 15 |
+ source_url: source_url, guid: guid, tag_fg_color: tag_fg_color, |
|
| 16 |
+ tag_bg_color: tag_bg_color, icon: icon) } |
|
| 15 | 17 |
|
| 16 | 18 |
it "outputs a structure containing name, description, the date, all agents & their links" do |
| 17 | 19 |
data = exporter.as_json |
@@ -22,6 +24,7 @@ describe AgentsExporter do |
||
| 22 | 24 |
expect(data[:schema_version]).to eq(1) |
| 23 | 25 |
expect(data[:tag_fg_color]).to eq(tag_fg_color) |
| 24 | 26 |
expect(data[:tag_bg_color]).to eq(tag_bg_color) |
| 27 |
+ expect(data[:icon]).to eq(icon) |
|
| 25 | 28 |
expect(Time.parse(data[:exported_at])).to be_within(2).of(Time.now.utc) |
| 26 | 29 |
expect(data[:links]).to eq([{ :source => guid_order(agent_list, :jane_weather_agent), :receiver => guid_order(agent_list, :jane_rain_notifier_agent)}])
|
| 27 | 30 |
expect(data[:control_links]).to eq([]) |